package product.controller;

import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import product.api.ProductApi;
import product.model.OrderInfo;
import product.model.ProductInfo;
import product.server.ProductServer;

@Slf4j
@RestController
@RequestMapping("/product")
public class ProductController implements ProductApi {

    @Autowired
    ProductServer productServer;

    @Override
    public ProductInfo getProductInfo(Long productId) {
        ProductInfo o = productServer.getOrderById(productId);
        log.info("收到请求 = {}", o.getId());
        return o;
    }

    @Override
    public void o1(Long id, String name) {
        log.info("收到请求 id = {},name = {}", id, name);
    }

    @Override
    public void o2(OrderInfo orderInfo) {
        log.info("收到请求 orderInfo = {}", orderInfo.toString());
    }

    @Override
    public void o3(OrderInfo orderInfo) {
        log.info("收到请求 orderInfo = {}", orderInfo.toString());
    }

}
